<template>
    <view class="my">
        <view class="img">
            <image mode='widthFix' src="https://bpy.noogka.com/icon/logo.png">
            </image>
        </view>
        <view class="name">{{ userInfo.user_name }}</view>

        <view class="footer">
            <view class="btn">
                <u-button @click="on_withdrawFrom" type="error" size="large " text="退出登录"></u-button>
            </view>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            userInfo: {}
        };
    },
    onShow() {
        this.userInfo = uni.getStorageSync('userInfo')
    },
    methods: {
        on_withdrawFrom() {
            this.$request.request({
                url: 'passport/logout',
                method: 'POST',
            }).then(res => {
                uni.navigateTo({
                    url: '/pages/login'
                })
            }).finally(() => {
            })

        }
    },
};
</script>
<style lang="scss" scoped>
.my {
    padding: 40rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    .img {
        width: 160rpx;
        height: 160rpx;
        border-radius: 50%;
        overflow: hidden;
        margin-top: 80rpx;

        image {
            width: 100%;
            height: 100%;
        }
    }

    .name {
        margin-top: 40rpx;
        font-size: 16px;
    }

    .footer {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        bottom: 18%;
        width: 100%;

        .btn {
            padding: 0 100rpx;
        }
    }
}
</style>